<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript">
            function doPopupWindow(obj) {
                var pkid = obj.parentNode.parentNode.parentNode.getAttribute("data-rk");
                var popupwindow = window.open("common/actInfoForm.xhtml?pkid=" + pkid, "", "height=600,width=800,left=200,top=100,toolbar=no,menubar=no,scrollbars=yes,location=no");
                popupwindow.focus;
            }
            function recordEdit(obj) {
                var pkid = obj.parentNode.parentNode.parentNode.getAttribute("data-rk");
                var sfeature = "dialogwidth:800px; dialogheight:520px;center:yes;help:yes;resizable:yes;scroll:yes;status:yes";
                var arg = new Object();
                arg.doType = "edit";
                var rtn = dialog("customerEdit.xhtml?custID=" + pkid + "&amp;doType=eidt", arg, sfeature);
                if (rtn == "1") {
                    document.getElementById("queryForm:qryBtn").click();
                }
            }
        </script>
        <style type="text/css">
            .col-95 {
                width: 95%;
            }

            .col-5 {
                width: 5%;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false"
                       style="font-weight:normal;font-style:normal;width:100%">
                <p:tab title="仓库信息管理">
                    <h:form>
                        <div id="qrytable">
                            <p:growl id="msgs" showDetail="false"/>
                            <p:panel style="margin-top:10px">
                                <h:panelGrid columns="2" cellspacing="5" columnClasses="col-95,col-5">
                                    <h:panelGrid columns="4" cellspacing="5">
                                        <h:outputLabel value="仓库编码:" style="font-weight: bold"/>
                                        <p:inputText value="#{customerAction.strCustCode}"/>
                                        <h:outputLabel value="仓库名称:" style="font-weight: bold"/>
                                        <p:inputText value="#{customerAction.strCustName}"/>
                                    </h:panelGrid>
                                    <h:panelGrid>
                                        <p:commandButton style="width:90px;" value="查询"
                                                         action="#{customerAction.queryCustomer}"
                                                         update="pdt,msgs">
                                        </p:commandButton>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                         value="#{customerAction.listCustomer}" var="record"
                                         rowKey="#{record.pkid}"
                                         selection="#{customerAction.selectedOaCustomerRecords}"
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         paginator="true" rows="15" paginatorPosition="bottom"
                                         rowsPerPageTemplate="100,50,30,15,5"
                                         emptyMessage="...">
                                <p:column headerText="仓库编码">
                                    <h:outputText value="#{record.custCode}"/>
                                </p:column>

                                <p:column headerText="仓库名称">
                                    <h:outputText value="#{record.custName}"/>
                                </p:column>

                                <p:column headerText="仓库位置">
                                    <h:outputText value="#{record.custRelation}"/>
                                </p:column>

                                <p:column headerText="电话">
                                    <h:outputText value="#{record.custTele}"/>
                                </p:column>

                                <p:column headerText="状态">
                                    <h:outputText value="#{customerAction.useStatus.valueOfAlias(record.isUse).title}"/>
                                </p:column>

                                <p:column headerText="操作" style="text-align:center">
                                    <h:commandLink onclick="recordEdit(this)" value="修改" style="color: blue"/>
                                    <h:commandLink id="btnDelete" immediate="false"
                                                   onclick="if (confirm('确定删除 '+this.parentNode.parentNode.children[1].innerHTML+'？')) return true;else return false;"
                                                   action="#{customerAction.cancelCustomer}"
                                                   value="删除" style="margin-left: 7px;color:blue">
                                        <f:param name="pkid" value="#{record.id}"/>
                                    </h:commandLink>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>